<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>居民列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入 Bootstrap -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"rel="stylesheet">
</head>
<body>
<div class="container">
    <div class="row clearfix">
        <div class="col-md-12 column">
            <div class="page-header">
                <h1>
                    <small>显示所有居民信息</small>
                </h1>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-5 column">
            <a class="btn btn-primary"href="${pageContext.request.contextPath}/user/toAddUser">新增居民</a>
            <a class="btn btn-primary" href="${pageContext.request.contextPath}/user/allUser">显示全部居民</a>
            <a class="btn btn-primary" href="${pageContext.request.contextPath}/worker/allWorker">显示所有工作人员</a>
            <a class="btn btn-primary" href="${pageContext.request.contextPath}/user/commit">显示居民建议</a>
        </div>

    <div class="col-md-4 column" style="float: right">
        <form class="form-inline" action="${pageContext.request.contextPath}/user/queryUser" method="post"
              style="float: right">
            <span style="color:red;font-weight: bold">${error}
            </span>
            <input type="text" name="queryUserName" class="form-control"
                   placeholder="输入查询用户名" required>
            <input type="submit" value="查询" class="btn btn-primary">
        </form>
    </div>
</div>
    <div class="row clearfix">
        <div class="col-md-12 column">
            <table class="table table-hover table-striped">
                <thead>
                <tr>
                    <th>居民编号</th>
                    <th>居民姓名</th>
                    <th>居民年龄</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach var="User" items="${requestScope.get('list')}">
                    <tr>
                        <td>${User.getUserID()}</td>
                        <td>${User.getUserName()}</td>
                        <td>${User.getUserAge()}</td>
                        <td>
                            <a href="${pageContext.request.contextPath}/user/toUpdateUser?id=${User.getUserID()}">更改</a> |
                            <a href="${pageContext.request.contextPath}/user/del/${User.getUserID()}">删除</a>
                        </td>

                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </div>
</div>